<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>弹出框与警告框</title>
    <link rel="stylesheet" href="../css/bootstrap.css">
</head>
<style>
    main{
        margin: 20px;
    }
</style>
<body>
    <main>
        <div class="alert alert-primary" role="alert">
            alert
            <a href="#" class="alert-link">help</a>
        </div>
        <div class="alert alert-secondary" role="alert">
            alert
            <a href="#" class="alert-link">help</a>
        </div>
        <div class="alert alert-success" role="alert">
            alert
            <a href="#" class="alert-link">help</a>
        </div>
        <div class="alert alert-danger" role="alert">
            alert
            <a href="#" class="alert-link">help</a>
        </div>
        <div class="alert alert-warning" role="alert">
            alert
            <a href="#" class="alert-link">help</a>
        </div>
        <div class="alert alert-info" role="alert">
            alert
            <a href="#" class="alert-link">help</a>
        </div>
        <div class="alert alert-light" role="alert">
            alert
            <a href="#" class="alert-link">help</a>
        </div>
        <div class="alert alert-dark" role="alert">
            alert
            <a href="#" class="alert-link">help</a>
        </div>

        <div class="alert alert-primary">
            <h5>标题文字</h5>
            <hr>
            <span>文本内容文本内容文本内容文本内容文本内容文本内容</span>
        </div>

        <div class="alert alert-dark show fade alert-dismissible">
            <strong>温馨提示</strong> 你的手机已欠费, 请及时充值
            <button type="button" class="close" data-dismiss="alert" aria-label="Close">&times;</button>
        </div>

        <div class="alert alert-warning show fade" id="alert-div">
            <strong>温馨提示</strong> 你的手机已欠费, 请及时充值, 请用Jquery来关闭我
            <button id="alert-butten" type="button" class="close">&times;</button>
        </div>
    </main>

    <script src="../js/jquery.min.js"></script>
    <script src="../js/bootstrap.js"></script>
    <script>
        $('#alert-butten').click(function(){
            $('#alert-div').alert('close');
        });
        // 在alert关闭时触发的事件
        $('#alert-div').on('closed.bs.alert', function () {
            console.log('closed.bs.alert 事件被触发');
        });
        // alert关闭后触发的事件
        $('#alert-div').on('close.bs.alert', function () {
            console.log('close.bs.alert 事件被触发');
        });
    </script>
</body>
</html>